|
|
|
|
|
|
|
Puzzle 6
Icon Fix This One |
|
|
|
|
|
|
|
|
Most programmers are familiar with iconsthose cute little rectangular symbols that are used throughout Windows.1 Icons can be stored in individual icon files (typically with the extension .ico) or as resources within Windows executables and dynamic link libraries. |
|
|
|
|
|
|
|
|
The Windows system provides a number of built-in icons that can be loaded using the LoadIcon function. This function is defined as follows under the Win32 documentation: |
|
|
|
|
|
|
|
|
HICON LoadIcon( HINSTANCE hInstance, // handle of application instance
LPCTSTR lpIconName // icon-name string or icon resource identifier
); |
|
|
|
|
|
|
|
|
This looks quite simple. The hInstance parameter, like all handles, will be a Long and passed by value. The lpIconName parameter is a string. The type breaks down as follows: |
|
|
|
|
| LP | Long (far) Pointer | | C | Constant, meaning that the API function does not change the contents of the string | | T | Varies depending on entry point. The string will be ANSI for the ANSI entry point, Unicode for the Unicode entry point. | | STR | NULL-terminated C string |
|
|
|
|
|
|
The declaration is therefore |
|
|
|
|
|
|
|
|
Private Declare Function LoadIcon Lib "user32.dll" Alias "LoadIconA" _
( ByVal hInstance As Long, _
ByVal lpIconName As String) As Long |
|
|
|
 |
|
 |
|
|
1 Rectangular, you ask? Icons are always rectangularbut portions of an icon can be made transparent, so they may seem to have many different shapes. |
|
|
|
|
|